home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Tickle-4.0 (tcl)
/
src
/
XTCL_Pascal_callback.c
< prev
next >
Wrap
Text File
|
1993-11-18
|
2KB
|
70 lines
/*
** This source code was written by Tim Endres
** Email: time@ice.com.
** USMail: 8840 Main Street, Whitmore Lake, MI 48189
**
** Some portions of this application utilize sources
** that are copyrighted by ICE Engineering, Inc., and
** ICE Engineering retains all rights to those sources.
**
** Neither ICE Engineering, Inc., nor Tim Endres,
** warrants this source code for any reason, and neither
** party assumes any responsbility for the use of these
** sources, libraries, or applications. The user of these
** sources and binaries assumes all responsbilities for
** any resulting consequences.
*/
#include <Types.h>
#include <Resources.h>
#include <QuickDraw.h>
#include <Windows.h>
#include <Memory.h>
#include "tcl.h"
#include "xtcl.h"
pascal void
PXTCLEntry(argc, argv, xpb)
int argc;
char **argv;
XTCLParmBlk *xpb;
{
long length;
int result;
Handle rHandle, sHandle;
char *script = argv[1];
extern pascal int XTCLCallBack(XTCLParmBlk *xpb, Handle sH, Handle rH, Handle oH);
#pragma unused (argc)
xpb->result = TCL_OK;
length = strlen(script);
sHandle = NewHandle(length+1);
rHandle = NewHandle(0);
if (sHandle != NULL && rHandle != NULL) {
strcpy(*sHandle, script);
result = XTCLCallBack(xpb, sHandle, rHandle, NULL);
/* result = (* xpb->eval)(xpb, sHandle, rHandle, NULL); */
length = GetHandleSize(rHandle);
SetHandleSize(xpb->resultH, length + 1);
if (MemError() == noErr) {
memcpy(*xpb->resultH, *rHandle, GetHandleSize(rHandle));
* (*xpb->resultH + length) = '\0';
}
else
result = TCL_ERROR;
xpb->result = result;
}
if (sHandle != NULL)
DisposHandle(sHandle);
if (rHandle != NULL)
DisposHandle(rHandle);
}